import {request} from "@/network/request";

//多条件查询资质证照
export function getCertificateByKey(certification){
  return request({
    url:'/api/admin/getCertificateByKey',
    method: 'post',
    data:{
      cer_id: certification.cer_id==''?-1:certification.cer_id,
      cer_name:certification.cer_name,
      ser_id:certification.ser_id==''?-1:certification.ser_id,
      cer_kind:certification.cer_kind,
      cer_type:certification.cer_type
    }
  })
}

//新建资质证照
export function insertCertificate(certification){
  return request({
    url:'/api/admin/insertCertificate',
    method:'post',
    data: {
      cer_name:certification.cer_name,
      // cer_kind:certification.cer_kind,
      cer_type:certification.cer_type,
      ser_id:certification.ser_id,
      cer_price: parseFloat(certification.cer_price),
    }
  })
}

//更新资质证照
export function updateCertificate(certification){
  return request({
    url:'/api/admin/updateCertificate',
    method:'post',
    data:{
      cer_id:certification.cer_id,
      cer_name:certification.cer_name,
      // cer_kind:certification.cer_kind,
      cer_type:certification.cer_type,
      ser_id:certification.ser_id,
      cer_price: parseFloat(certification.cer_price)
    }
  })
}

//删除资质证照
export function deleteCertificate(id){
  return request({
    url:'/api/admin/deleteCertificate',
    method:'get',
    params:{id}
  })
}

//切换资质证照的状态
export function updateCertificateType(id){
  return request({
    url:'/api/admin/updateCertificateType',
    method:'get',
    params:{id}
  })
}
